package com.bootcamp.javase2.stream.fileutils;

import java.io.File;

/**
 * @program: CharacterStreamCode
 * @description:
 * @author: Keyu Li
 * @create: 2021-09-10 20:31
 **/
public class FileUtils {
    public static void printDirResur(File dir){
        printHelper(dir, 0);
        System.out.println();
    }

    private static void printHelper(File dir, int count){
        File[] files = dir.listFiles();
        System.out.println();
        for (int i = 0; i < count; i++) {
            System.out.print("---");
        }
        System.out.print(dir.getName());
        if (files==null) return;
        System.out.print(":");
        for (File file : files) {
            printHelper(file, count+1);
        }
    }
}